package com.lf.sms.aliyun;

import com.lf.sms.flybird.FlyBird;
import lombok.extern.slf4j.Slf4j;

/*
pom.xml
<dependency>
  <groupId>com.aliyun</groupId>
  <artifactId>aliyun-java-sdk-core</artifactId>
  <version>4.0.3</version>
</dependency>
*/
/**
 * @Description:阿里云市场短信服务接口
 * @Param:
 * @return:
 * @Author: GXL
 * @Date: 2019/12/12
 */
@Slf4j
public class SendSms {

//    private static final String APP_KEY = "LTAI4Fxde8ESKT3i6Bxnvw3i";
//    private static final String APP_SECRET = "zcs7akA8hhVzXq1WA2HRRYVohgTmI7";
//    private static final String SIGN_NAME = "品质生活";
//    private static final String TEMPLATE_CODE = "SMS_180053622";
//    private static final String REGION_ID = "cn-hangzhou";
//
//
//    public static String send(String code,String mobile) {
//        DefaultProfile profile = DefaultProfile.getProfile(REGION_ID, APP_KEY, APP_SECRET);
//        IAcsClient client = new DefaultAcsClient(profile);
//        CommonRequest request = new CommonRequest();
//        request.setMethod(MethodType.POST);
//        request.setDomain("dysmsapi.aliyuncs.com");
//        request.setVersion("2017-05-25");
//        request.setAction("SendSms");
//        request.putQueryParameter("RegionId", REGION_ID);
//        request.putQueryParameter("PhoneNumbers", mobile);
//        request.putQueryParameter("SignName", SIGN_NAME);
//        request.putQueryParameter("TemplateCode", TEMPLATE_CODE);
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("code", code);
//        //消息模板参数：{“code”：1548}
//        request.putQueryParameter("TemplateParam", jsonObject.toJSONString());
//        try {
//            CommonResponse response = client.getCommonResponse(request);
//            log.info(response.getData());
//            return response.getData();
//        } catch (ServerException e) {
//        } catch (ClientException e) {
//        }
//        return null;
//    }

    public static void send(String code,String mobile) {
        FlyBird.SendSms(code,mobile);
    }
}